﻿@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>我的桌面</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link href="~/lib/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/lib/fontawesome/4.7.0/css/fontawesome.min.css" rel="stylesheet" />
    @*<link href="~/Content/adminLTE/css/index.css" rel="stylesheet" />*@
    <script src="~/lib/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/echarts/4.3.0/echarts.min.js"></script>
    <script>
        $(function () {
            if ($('#areascontent').height() > $(window).height() - 20) {
                $('#areascontent').css("margin-right", "0px");
            }
            $('#areascontent').height($(window).height() - 22);
            $(window).resize(function (e) {
                window.setTimeout(function () {
                    $('#areascontent').height($(window).height() - 22);
                }, 200);
            });
            $(".btn-group>.btn").click(function () {
                $(this).siblings().removeClass('btn-danger');
                $(this).addClass('btn-danger');
            });
            bindApplyList();
            bindDetectionList();
            initChart1('all');
            initChart2('all');
        });
        function bindApplyList() {
            var data = {
                auditStatus: -1,pageSize: 5,pageIndex: 1,sort: 'BaseCreateTime',sortType: 'desc'};
            $.get('@Url.Content("~/YiDongYuan/MechanicsApply/GetPageListJson")', data, function (result) {
                if (result && result.Tag == 1) {
                    var list = result.Data;
                    var html = '';
                    for (var i = 0; i < list.length; i++) {
                        html = '<li>' + (i + 1) + ' , <span> ' + list[i].BaseCreateTime + '</span> <span>' + list[i].OwnerName + '</span>上报一台<span>' + list[i].JXLB + '</span></li>';
                        $("#applyList").append(html);
                    }
                }
            }, 'json');
        }
        function bindDetectionList() {
             var data = {
                 DetectionStatus: 1,pageSize: 5,pageIndex: 1,sort: 'DetectionTime',sortType: 'desc'};
            $.get('@Url.Content("~/YiDongYuan/DetectionTask/GetPageListJson")', data, function (result) {
                if (result && result.Tag == 1) {
                    var list = result.Data;
                    var html = '';
                    for (var i = 0; i < list.length; i++) {
                        html = '<li>' + (i + 1) + ' , <span> ' + list[i].DetectionTime + '</span> <span>' + list[i].DetectionUserName+'</span> 完成检测 <span>' + list[i].HuanBaoCode + '</span> 检测结果：<span>' + (list[i].DetectionInfoResult == 1 ? '不合格' : '合格') + '</span> 低排区：<span>' + (list[i].DetectionInfoResultDPQ == 0 ? '合格' : '不合格') + '</span></li>';
                        $("#detectionList").append(html);
                    }
                }
            }, 'json');
        }
        function initChart1(type) {
            var chart1 = echarts.init(document.getElementById('chart1'));
            chart1.showLoading();
            var queryUrl = '@Url.Content("~/YiDongYuan/AdminDesk/MechanicsRegionReport")';
            $.post(
                queryUrl,
                { type: type }, function (result, msg) {

                    var names = [], counts = [];
                    result.Data.forEach(function (item, index) {
                        names.push(item.RegionName);
                        counts.push(item.RegionValue);
                    });
                    chart1.hideLoading();
                    chart1.setOption({
                        tooltip: {
                            show: true
                        },
                        xAxis: {
                            axisLabel: {
                                interval: 0,
                                rotate: 45,
                            },
                            data: names
                        },
                        yAxis: {},
                        series: [{
                            name: '数量',
                            type: 'bar',
                            data: counts,
                            itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        //rotate : 90,
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: '#000000',
                                            fontSize: 14
                                        }
                                    }
                                }
                            },
                        }]
                    });
                }, 'json');
        }
        function initChart2(type) {//
            var chart1 = echarts.init(document.getElementById('chart3'));
            chart1.showLoading();
            var queryUrl = '@Url.Content("~/YiDongYuan/AdminDesk/TaskRegionReport")';
            $.post(
                queryUrl,
                { type: type }, function (result, msg) {
                    var names = [], counts = [];
                    console.log(result.Data);
                    result.Data.forEach(function (item, index) {
                        names.push(item.RegionName);
                        counts.push(item.RegionValue);
                    });
                    chart1.hideLoading();
                    chart1.setOption({
                        tooltip: {
                            show: true
                        },
                        xAxis: {
                            axisLabel: {
                                interval: 0,
                                rotate: 45,
                            },
                            data: names
                        },
                        yAxis: {},
                        series: [{
                            name: '数量',
                            type: 'bar',
                            data: counts,
                            itemStyle: {
                                normal: {
                                    label: {
                                        show: true, //开启显示
                                        //rotate : 90,
                                        position: 'top', //在上方显示
                                        textStyle: { //数值样式
                                            color: '#000000',
                                            fontSize: 14
                                        }
                                    }
                                }
                            },
                        }]
                    });
                }, 'json');
        }
    </script>
</head>
<body style="overflow: hidden; margin: 0px;">
    <div id="areascontent" style="margin: 10px 10px 0 10px; margin-bottom: 0px; overflow: auto;">
        <div class="rows" style="margin-bottom: 0.8%; overflow: hidden;height:100px;">
            <div style="float: left; width: 99.9%;">
                <div style="height: 100%; border: 1px solid #e6e6e6; overflow: hidden;">
                    <div class="dashboard-stats">
                        <div class="dashboard-stats-item" style="background-color: #578ebe;">
                            <div class="stat-icon">
                                <i class="fa fa-clock-o"></i>
                            </div>
                            <h2 class="m-top-none">@(ViewBag.dshCount + ViewBag.yshCount)<span>辆</span></h2>
                            <h5>已备案机械</h5>
                        </div>
                    </div>
                    <div class="dashboard-stats">
                        <div class="dashboard-stats-item" style="background-color: #e35b5a;">
                            <h2 class="m-top-none">@ViewBag.dshCount<span>辆</span></h2>
                            <h5>待审核机械</h5>
                            <div class="stat-icon">
                                <i class="fa fa-bell"></i>
                            </div>
                        </div>
                    </div>
                    <div class="dashboard-stats">
                        <div class="dashboard-stats-item" style="background-color: #44b6ae;">
                            <h2 class="m-top-none">@ViewBag.yshCount<span>辆</span></h2>
                            <h5>初审完成</h5>
                            <div class="stat-icon">
                                <i class="fa fa-envelope-o"></i>
                            </div>
                        </div>
                    </div>
                    <div class="dashboard-stats">
                        <div class="dashboard-stats-item" style="background-color: #8775a7;">
                            <h2 class="m-top-none">@ViewBag.dhsCount<span>辆</span></h2>
                            <h5>待核实机械</h5>
                            <div class="stat-icon">
                                <i class="fa fa-gavel"></i>
                            </div>
                        </div>
                    </div>
                    <div class="dashboard-stats">
                        <div class="dashboard-stats-item" style="background-color: #14aae4; margin-bottom: 0px;">
                            <h2 class="m-top-none">@ViewBag.fjCount<span>辆</span></h2>
                            <h5>复检</h5>
                            <div class="stat-icon">
                                <i class="fa fa-file-text-o"></i>
                            </div>
                        </div>
                    </div>
                    <div class="dashboard-stats">
                        <div class="dashboard-stats-item" style="background-color: #f29503;margin-bottom: 0px;">
                            <h2 class="m-top-none">@ViewBag.yjcCount<span>辆</span></h2>
                            <h5>已检测机械</h5>
                            <div class="stat-icon">
                                <i class="fa fa-shopping-cart"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="rows" style="margin-bottom: 0.8%; overflow: hidden;">
            <div style="float: left; width: 50%;">
                <div style="height: 250px; border: 1px solid #e6e6e6; background-color: #fff;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-bar-chart fa-lg" style="padding-right: 5px;"></i>最新备案
                        </div>
                        <div class="panel-body">
                            <div class="ibox-content" style="font-size:16px;padding:10px">
                                <ul id="applyList">
                                                                    
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div style="float: right; width: 49.2%;">
                <div style="height: 250px; border: 1px solid #e6e6e6; background-color: #fff;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-pie-chart fa-lg" style="padding-right: 5px;"></i>最新检测                                                       
                        </div>
                        <div class="panel-body">
                            <div class="ibox-content" style="font-size:16px;padding:10px;">
                                <ul id="detectionList">
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="rows" style="margin-bottom: 0.8%; overflow: hidden;">
            <div style="float: left; width: 50%;">
                <div style="height: 290px; border: 1px solid #e6e6e6; background-color: #fff;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-bar-chart fa-lg" style="padding-right: 5px;"></i>非道路移动机械设备统计

                            <div style="float:right;">
                                <div class="btn-group btn-group-xs">
                                    <button type="button" class="btn btn-default btn-danger" onclick="initChart1('all')">全部</button>
                                    <button type="button" class="btn btn-default" onclick="initChart1('month')">本月</button>
                                    <button type="button" class="btn btn-default" onclick="initChart1('today')">今日</button>
                                </div>
                            </div>
                        </div>
                        <div class="panel-body">
                            <div id="chart1" style="height: 230px; width: 100%;"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div style="float: right; width: 49.2%;">
                <div style="height: 290px; border: 1px solid #e6e6e6; background-color: #fff;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <i class="fa fa-pie-chart fa-lg" style="padding-right: 5px;"></i>检测数量统计

                            <div style="float:right;">
                                <div class="btn-group btn-group-xs">
                                    <button type="button" class="btn btn-default btn-danger" onclick="initChart2('all')">全部</button>
                                    <button type="button" class="btn btn-default" onclick="initChart2('month')">本月</button>
                                    <button type="button" class="btn btn-default" onclick="initChart2('today')">今日</button>
                                </div>
                            </div>
                        </div>
                        <div class="panel-body">
                            <div id="chart3" style="height: 230px; width: 100%; margin-top: 10px;"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <style>
        #copyrightcontent {
            height: 30px;
            line-height: 29px;
            overflow: hidden;
            position: absolute;
            top: 100%;
            margin-top: -30px;
            width: 100%;
            background-color: #fff;
            border: 1px solid #e6e6e6;
            padding-left: 10px;
            padding-right: 10px;
        }

        .dashboard-stats {
            float: left;
            width: 16.6%;
        }

        .dashboard-stats-item {
            position: relative;
            overflow: hidden;
            color: #fff;
            cursor: pointer;
            height: 95px;
            margin-right: 10px;
            margin-bottom: 10px;
            padding-left: 15px;
            padding-top: 15px;
        }

            .dashboard-stats-item .m-top-none {
                margin-top: 5px;
            }

            .dashboard-stats-item h2 {
                font-size: 32px;
                font-family: inherit;
                line-height: 1.1;
                font-weight: 500;
                padding-left: 70px;
            }

                .dashboard-stats-item h2 span {
                    font-size: 12px;
                    padding-left: 5px;
                }

            .dashboard-stats-item h5 {
                font-size: 16px;
                font-family: inherit;
                margin-top: 1px;
                line-height: 1.1;
                padding-left: 70px;
            }

            .dashboard-stats-item .stat-icon {
                position: absolute;
                top: 15px;
                font-size: 50px;
                opacity: .3;
            }

        .dashboard-stats i.fa.stats-icon {
            width: 50px;
            padding: 20px;
            font-size: 50px;
            text-align: center;
            color: #fff;
            height: 50px;
            border-radius: 10px;
        }

        .panel-default {
            border: none;
            border-radius: 0px;
            margin-bottom: 0px;
            box-shadow: none;
            -webkit-box-shadow: none;
        }

            .panel-default > .panel-heading {
                color: #777;
                background-color: #fff;
                border-color: #e6e6e6;
                padding: 10px 10px;
            }

            .panel-default > .panel-body {
                padding: 10px;
                padding-bottom: 0px;
            }

                .panel-default > .panel-body ul {
                    overflow: hidden;
                    padding: 0;
                    margin: 0px;
                    margin-top: -5px;
                }

                    .panel-default > .panel-body ul li {
                        line-height: 35px;
                        list-style-type: none;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                    }
                    .panel-default > .panel-body ul li span{
                        margin:0 5px;
                    }

                        .panel-default > .panel-body ul li .time {
                            color: #a1a1a1;
                            float: right;
                            padding-right: 5px;
                        }
    </style>
</body>
</html>
